package com.ygqh.baby.service.wechat;

import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;

import javax.xml.parsers.ParserConfigurationException;

import org.xml.sax.SAXException;

import com.foxinmy.weixin4j.api.CashApi;
import com.foxinmy.weixin4j.exception.WeixinException;
import com.foxinmy.weixin4j.payment.mch.Redpacket;
import com.foxinmy.weixin4j.payment.mch.RedpacketRecord;
import com.foxinmy.weixin4j.payment.mch.RedpacketSendResult;
import com.foxinmy.weixin4j.payment.mch.RefundRecord;
import com.foxinmy.weixin4j.payment.mch.RefundResult;
import com.ygqh.baby.ao.Message;
import com.ygqh.baby.exception.YgException;
import com.ygqh.baby.service.wechat.protocol.UnifiedOrderReqData;

public interface YgWeChatService {

	/**
	 * 微信支付统一下单接口 jsapi
	 * 
	 * @return
	 * @throws ParserConfigurationException
	 * @throws SAXException
	 * @throws IOException
	 * @throws IllegalAccessException
	 */
	public Message UnifiedOrderJSAPI(UnifiedOrderReqData reqData) throws IOException, SAXException,
			ParserConfigurationException, IllegalAccessException;

	/**
	 * 微信支付统一下单接口 NATIVE
	 * 
	 * @return
	 * @throws ParserConfigurationException
	 * @throws SAXException
	 * @throws IOException
	 * @throws IllegalAccessException
	 */
	public Message UnifiedOrderNATIVE(UnifiedOrderReqData reqData) throws IOException, SAXException,
			ParserConfigurationException, IllegalAccessException;

	/**
	 * notify_url 统一下单回调
	 * 
	 * @return
	 */
	public String UnifiedOrderCallBack(String requestXml);

	/**
	 * 微信充值回调
	 * 
	 * @param result
	 * @return
	 */
	public String rechargeCallBack(String result);

	/**
	 * 申请退款
	 * 
	 * @param refundPrice
	 * @param orderPayCode
	 * @param orderPrice
	 * 
	 * @param Message
	 * @return
	 * @throws YgException
	 */
	public RefundResult refund(String returnCode, BigDecimal refundPrice, BigDecimal orderPrice, String orderPayCode)
			throws YgException;

	/**
	 * 申请退款
	 * 
	 * @param Message
	 * @return
	 * @throws YgException
	 */
	public RefundRecord refundQuery(String returnOrderCode) throws YgException;

	/**
	 * 快闪店支付回调
	 * 
	 * @Title: KSDUnifiedOrderCallBack
	 * @param result
	 *            入参
	 * @return String 返回类型
	 * @author （guohao）
	 * @throws
	 * @date 2017年7月18日 下午3:20:42
	 * @version V1.0
	 */
	public String KSDUnifiedOrderCallBack(String result);

	public RedpacketSendResult sendRedpack(Redpacket redpacket) throws YgException;

	public RedpacketRecord queryRedpack(String outTradeNo) throws WeixinException;
}
